RESTful Web APIs by Leonard Richardson Mike Amundsen and Sam Ruby

RESTful Web APIs by Leonard Richardson Mike Amundsen and Sam Ruby

Author:Leonard Richardson, Mike Amundsen, and Sam Ruby
Language: eng
Format: epub
Tags: COMPUTERS / Web / Web Programming
ISBN: 9781449358051
Publisher: O’Reilly Media
Published: 2013-09-12T00:00:00+00:00


Versoning isn’t special

API versioning gets a lot of attention because the problem is a lot worse for an API that ignores the hypermedia constraint. But it’s just one example of the general problem addressed by hypermedia. How does the client know which resource has the representation it wants? Once the client gets a representation, how is it supposed to know what the representation means? The techniques I gave earlier are the techniques a server uses in general when giving the client a choice between representations.

A server can give out links to two different URLs, and the client can choose which link to follow based on an understanding of the application semantics. It’s the same whether the two URLs point to completely different resources, or to the v1 and v2 versions of a single underlying resource.

A single resource may have representations in different media types. The client can select the representation it wants using content negotiation (with the Accept header; see Chapter 11) or hypermedia. It’s the same whether the media types are completely different (Collection+JSON and HTML), or whether they differ only by a version parameter. I think the version parameter is a bad idea, but if you use it, it’ll work the same way as if you used two completely different media types.

A single resource may be described by many different profiles, and the client can use content negotiation or hypermedia to select the one it wants. It’s the same whether the profiles are different approaches to the same idea (hCard versus schema.org’s Person) or whether they’re the “v1” and “v2” profiles of a single API.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.